Test Series - Data Structure

Test Number 68/115

Q: What are the disadvantages of normal binary tree traversals?
A. there are many pointers which are null and thus useless
B. there is no traversal which is efficient
C. complexity in implementing
D. improper traversals
Solution: As there are majority of pointers with null value going wasted we use threaded binary trees.
Q: What are null nodes filled with in a threaded binary tree?
A. inorder predecessor for left node and inorder successor for right node information
B. right node with inorder predecessor and left node with inorder successor information
C. they remain null
D. some other values randomly
Solution: If preorder or postorder is used then the respective predecessor and successor info is stored.
Q: What is a threaded binary tree traversal?
A. a binary tree traversal using stacks
B. a binary tree traversal using queues
C. a binary tree traversal using stacks and queues
D. a binary tree traversal without using stacks and queues
Solution: This type of tree traversal will not use stack or queue.
Q: What are double and single threaded trees?
A. when both left, right nodes are having null pointers and only right node is null pointer respectively
B. having 2 and 1 node
C. using single and double linked lists
D. using heaps and priority queues
Solution: They are properties of double and single threaded binary trees respectively.
Q: What is wrong with below code for inorder traversal of inorder threaded binary tree:

   inordertraversal(threadedtreenode root):
   threadedtreenode q = inorderpredecessor(root)
   while(q!=root):
   q=inorderpredecessor(q)
   print q.data
A. inordersuccessor instead of inorderpredecessor must be done
B. code is correct
C. it is code for post order
D. it is code for pre order
Solution: Property of inorder threaded binary tree is left node with inorder predecessor and right node with inorder successor information are stored.
Q: In general, the node content in a threaded binary tree is ________
A. leftchild_pointer, left_tag, data, right_tag, rightchild_pointer
B. leftchild_pointer, left_tag
C. leftchild_pointer, left_tag, right_tag, rightchild_pointer
D. leftchild_pointer, left_tag, data
Solution: It contains additional 2 pointers over normal binary tree node structure.
Q: Which of the following tree traversals work if the null left pointer pointing to the predecessor and null right pointer pointing to the successor in a binary tree?
A. inorder, postorder, preorder traversals
B. inorder
C. postorder
D. preorder
Solution: In threaded binary trees, the null left pointer points to the predecessor and the right null pointer point to the successor. In threaded binary trees, we can use in-order, preorder and postorder traversals to visit every node in the tree.
Q: Who developed the concept of tango tree?
A. Erik Demaine
B. Mihai Patrascu
C. John Lacono
D. All of the mentioned
Solution: Erik Demaine is a well-known professor of Computer Science at MIT. John Lacono is an American computer scientist specialized in data structure and algorithm while Mihai Patrascu was a Romanian- American computer scientist. All of them together developed the concept of Tango tree.
Q: Which type of tree is tango tree?
A. Ternary Tree
B. AVL Tree
C. Binary Search Tree
D. K-ary Tree
Solution: Tango tree is an example of binary search tree which was developed by four famous scientists Erik Demaine, Mihai Patrascu, John Lacono and Harmon in the year 2004.
Q: After which city is tango tree named?
A. Vatican City
B. Buenos Aires
C. New York
D. California
Solution: Tango is a popular couple dance or partner dance that was originated in the 1880s somewhere between Argentina and Uruguay. Buenos Aires is a capital city off Argentina. Hence they named after Buenos Aires.

You Have Score    /10